<template>
  <div class="detail">
    <div class="detail-top">
      <div class="detail-top-title">{{ date }}教师工资</div>
      <div class="detail-top-info">
        <p>
          <span class="detail-top-info-title">年月：</span>
          <span class="detail-top-info-content">{{ date }}</span>
        </p>
        <p>
          <span class="detail-top-info-title">是否发布：</span>
          <span class="detail-top-info-content">{{
            hasRelease === "1" ? "是" : "否"
          }}</span>
        </p>
        <p>
          <span class="detail-top-info-title">发布时间：</span>
          <span class="detail-top-info-content">{{ releaseDate }}</span>
        </p>
      </div>
    </div>
    <div class="detail-table">
      <a-table
        :dataSource="recData.dataSource"
        :columns="recData.columns"
        :pagination="false"
        bordered
        :scroll="{
          x: '-webkit-max-content' || '-moz-max-content' || 'intrinsic',
        }"
      />
    </div>
  </div>
</template>

<script lang="ts" setup>
import { useRoute } from "vue-router";
import { getSalaryData } from "@/service/modules/salary/pub";
import { reactive } from "vue";
const recData = reactive({
  dataSource: [],
  columns: [],
});
const { id, wageDate, releaseDate, hasRelease } = useRoute().query;
const date = wageDate.split("-")[0] + "年" + wageDate.split("-")[1] + "月";
getSalary(id);
async function getSalary(id) {
  const {
    code,
    data: { columns, dataSource },
  } = await getSalaryData(id);
  if (code === 0) {
    recData.columns = columns;
    recData.dataSource = dataSource;
  }
}
</script>

<style lang="less" scoped>
.detail {
  /* background: #fff; */
  padding: 16px;
  &-top,
  &-table {
    background: #fff;
    border-radius: 10px;
  }
  &-top {
    padding: 24px;
    &-info {
      display: flex;
      P {
        margin-bottom: 0;
      }
      &-title,
      &-content {
        font-size: 14px;
        color: #aaaeb2;
        line-height: 24px;
        font-weight: 400;
        letter-spacing: 2px;
      }
      &-content {
        color: #303233;
        margin-right: 48px;
        letter-spacing: 1px;
      }
    }
    &-title {
      font-size: 18px;
      font-weight: 600;
      color: #303233;
      line-height: 28px;
      margin-bottom: 12px;
      letter-spacing: 3px;
    }
  }
  &-table {
    padding: 24px;
    margin-top: 24px;
  }
}
</style>
